interface IAppState {
  collapsed: Boolean
}
const state: IAppState = {
  collapsed: localStorage.getItem('collapsed') === 'true'
}

const mutations = {
  OPEN_SIDE_BAR (state: IAppState) {
    localStorage.setItem('collapsed', 'false')
    state.collapsed = false
  },
  CLOSE_SIDE_BAR (state: IAppState) {
    localStorage.setItem('collapsed', 'true')
    state.collapsed = true
    console.log('222222', state)
  }
}

const actions = {
  openSideBar (context: any) {
    console.log('open')
    context.commit('OPEN_SIDE_BAR')
  },
  closeSideBar ({ commit }: any) {
    console.log('close')
    commit('CLOSE_SIDE_BAR')
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
